import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex)
import {INC} from '../mutations/index'
import {moduleA} from './moduleA'
import {moduleB} from './moduleB'

export default new Vuex.Store({
    state: {
        count:0,
        name:'abc'
    },
    mutations: {
        // inc(state,payload) {
        //     state.count += payload.num
        // },
        [INC](state,payload) {
            state.count += payload.num
        },
        dec(state,abc){
            state.count -= abc
        },
        rootM(){
            console.log('root')
        }
    },
    actions:{
        asyncInc(context){
            context.dispatch(INC)
        }
    },
    getters:{

    },
    modules:{
        moduleA,
        moduleB
    }
})